package com.example.freshmenapp;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity{
    EditText editText1,editText2,editText3,editText4,editText5,editText6;
    Button button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        button=findViewById(R.id.btn1);
        editText1=findViewById(R.id.edt1_yonghu);
        editText2=findViewById(R.id.edt2_name);
        editText3=findViewById(R.id.edt3_email);
        editText4=findViewById(R.id.edt4_phone);
        editText5=findViewById(R.id.edt5_password);
        editText6=findViewById(R.id.edt6_password2);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String edt1_yonghu = editText1.getText().toString();
                String edt2_name = editText2.getText().toString();
                String edt3_email = editText3.getText().toString();
                String edt4_phone = editText4.getText().toString();
                String edt5_password = editText5.getText().toString();
                String edt6_password2 = editText6.getText().toString();
                if (edt5_password.equals(edt6_password2)&&!edt1_yonghu.equals("")&&!edt2_name.equals("")&&!edt3_email.equals("")
                        &&!edt4_phone.equals("")&&!edt5_password.equals("")) {
                    Toast.makeText(MainActivity.this, "用户名：" + edt1_yonghu + ",真实姓名：" + edt2_name +
                            ",邮箱：" + edt3_email + ",电话：" + edt4_phone +",密码：" + edt5_password, Toast.LENGTH_LONG).show();
                }else{
                    Toast.makeText(MainActivity.this,"请按规则全部填写！！！", Toast.LENGTH_LONG).show();
                }
            }
        });
    }
}